package org.squareland.entities;

import android.graphics.Color;

public class DwarfEntity extends Entity {
	public DwarfEntity() {
		super(7, 5);
		int b = Color.BLACK;
		int g = Color.GREEN;
		int w = Color.WHITE;
		int r = Color.RED;
		int t = Color.TRANSPARENT;
		
		pixels = new int[][] {
				{t, b, b, b, t},
				{b, g, b, g, b},
				{w, w, w, w, w},
				{b, w, r, w, b},
				{b, b, w, b, b},
				{b, b, b, b, b},
				{t, b, t, b, t}
		};
		
		fireDelay = 300;
		lastFireTime = 0;
		maxHP = 100;
		HP = 100;
	}
	
	@Override
	public void collisionCollpack(Entity entity, long mills) {
		if (entity instanceof BulletEntity) {
			if (((BulletEntity)entity).generatedBy != this) {
				HP -= 10;
				HP = Math.max(0, HP);
				if (HP <= 0) {
					lifetime = 0;
				}
			}
		} else {
			x -= speedX * mills / 1000;
			y -= speedY * mills / 1000;
		} 
	}

	public long fireDelay;
	public long lastFireTime;
	public int maxHP;
	public int HP;
}
